#!/bin/sh

ip='10.100.6.60'
if [ $1 ]; then
  ip=$1
fi

passwd='<password>'
# echo -n "root@$ip's password: "
# read passwd

# deploy web
yarn build
sshpass -p $passwd ssh root@$ip /bin/sh << EOL
rm -rf /opt/web/dist
exit
EOL
sshpass -p $passwd scp -r dist root@$ip:/opt/web/

# deploy pdf
cd pdf/web/
npm run build
cd ../server/
sshpass -p $passwd scp index.html root@$ip:/opt/bas-server/report/server/
